<extend name="Public/layout"/>
<block name="head">
<link rel="stylesheet" href="__PUBLIC__css/matial.css">
<style type="text/css">
.footer{
  display: none;
}
</style>
</block>
   <block name="main">
    <div class="container">
      <div class="matial">
        <div class="matial-title">
          <h4>请选择您要加入的门派</h4>
        </div>
        <div class="matial-con">
          <ul>
            <li class="clearfix">
              <div class="item-tip">
                <p>撸毛派</p>
              </div>
              <div class="item-con">
                <p>熟知网贷返利规则，第一时间告知您如何投资实现收益最大化。</p>
              </div>
              <div class="item-check" check="0" attr_team='1'>
              </div>
            </li>
             <li class="clearfix">
              <div class="item-tip item-two">
                <p>稳健派</p>
              </div>
              <div class="item-con">
                <p>稳健投资为主，不以高返为目标，坚持稳健投资。</p>
              </div>
              <div  class="item-check" check="0" attr_team='2'>
              </div>
            </li>
             <li class="clearfix">
              <div class="item-tip item-three">
                <p>高利派</p>
              </div>
              <div class="item-con">
                <p>高收益，让您用同样的投资金额获取更高的投资收益。</p>
              </div>
              <div  class="item-check" check="0" attr_team='3'>
              </div>
            </li>
             <li class="clearfix">
              <div class="item-tip item-four">
                <p>短期派</p>
              </div>
              <div class="item-con">
                <p>已短期投资为主，不断复投，适合资金流动性较强的朋友。</p>
              </div>
              <div class="item-check" check="0" attr_team='4'>
              </div>
            </li>
            <li class="clearfix">
              <div class="item-tip item-five">
                <p>长期派</p>
              </div>
              <div class="item-con">
                <p>长期投资为主，懒人操作，适合业务繁忙，无时间打理投资的土豪们。</p>
              </div>
              <div class="item-check" check="0" attr_team='5'>
              </div>
            </li>
          </ul>
        </div>
      </div>
      <div class="matial">
        <div class="matial-title">
          <h4>请选择两个师门技能</h4>
        </div>
        <div class="matial-con">
          <ul>
            <li class="clearfix">
              <div class="skill-item item-tip item-two">
                <p>避雷神针</p>
              </div>
              <div class="item-con">
                <p>熟知网贷返利规则，第一时间告知您如何投资实现收益最大化。</p>
              </div>
              <div class="item-scheck" sCheck="0" attr_skill='1'>
              </div>
            </li>
             <li class="clearfix">
              <div class="skill-item  item-tip item-three">
                <p>活动高手</p>
              </div>
              <div class="item-con">
                <p>稳健投资为主，不以高返为目标，坚持稳健投资。</p>
              </div>
              <div class="item-scheck" sCheck="0" attr_skill='2'>
              </div>
            </li>
             <li class="clearfix">
              <div class="skill-item item-tip">
                <p>平台监控</p>
              </div>
              <div class="item-con">
                <p>高收益，让您用同样的投资金额获取更高的投资收益。</p>
              </div>
              <div class="item-scheck" sCheck="0" attr_skill='3'>
              </div>
            </li>
             <li class="clearfix">
              <div class="skill-item item-tip item-five">
                <p>资产配置</p>
              </div>
              <div class="item-con">
                <p>已短期投资为主，不断复投，适合资金流动性较强的朋友。</p>
              </div>
              <div class="item-scheck" sCheck="0" attr_skill='4'>
              </div>
            </li>
            <li class="clearfix">
              <div class="skill-item item-tip item-four">
                <p>野鸡杀手</p>
              </div>
              <div class="item-con">
                <p>长期投资为主，懒人操作，适合业务繁忙，无时间打理投资的土豪们。</p>
              </div>
              <div class="item-scheck" sCheck="0" attr_skill='5'>
              </div>
            </li>
          </ul>
        </div>
      </div>
      <div class="btn">
          <p>提交申请</p>
        </div>
    </div>
</block>
<block name="js">
    <script type="text/javascript">

    $('.item-check').click(function(){
      var is_check=$(this).attr('check')
      var j;
      $('.item-checked').each(function(i,v){
         j = i
      })
      //console.log(j)
      if(j>=2 && is_check==0){
           layer.open({
              content: '最多只能选择三个门派派系！'
              ,skin: 'msg'
              ,time: 2 //2秒后自动关闭
            });
      }else{

        if(is_check==1){
          $(this).attr('check','0');
          $(this).removeClass('item-checked');
          $(this).parent('li').removeClass('item-active');
          $(this).addClass('item-check');
        }else{
           $(this).attr('check','1');
           $(this).removeClass('item-check');
          $(this).addClass('item-checked');
          $(this).parent('li').addClass('item-active');
        }
      }
    });

    $('.item-scheck').click(function(){
      var is_check=$(this).attr('scheck')
      var j = 0;
      $('.item-schecked').each(function(i,v){
         j = i
      })
    //  console.log(j)
      if(j>=1 && is_check==0){
           layer.open({
              content: '只能选择两个师门技能！'
              ,skin: 'msg'
              ,time: 2 //2秒后自动关闭
            });
      }else{

        if(is_check==1){
          $(this).attr('scheck','0');
          $(this).removeClass('item-schecked');
          $(this).parent('li').removeClass('item-active');
          $(this).addClass('item-scheck');
        }else{
           $(this).attr('scheck','1');
           $(this).removeClass('item-scheck');
           $(this).parent('li').addClass('item-active');
          $(this).addClass('item-schecked');
        }
      }

    });
    $('.btn').click(function(){
      //派系
      var team=Array();
      $('.item-checked').each(function(i,v){
        if($(v).attr('check')==1){
          team.push($(v).attr('attr_team'))

        }
      })
      //技能
      var skill = Array();
      $('.item-schecked').each(function(i,v){
        if($(v).attr('sCheck')==1) {
          skill.push($(v).attr('attr_skill'));
        }
      })

      // console.log(skill);
      if(!$('.item-checked').length){
        layer.open({
              content: '请选择一个门派派系！'
              ,skin: 'msg'
              ,time: 2 //2秒后自动关闭
            });
      }else if(!$('.item-schecked').length){
          layer.open({
              content: '请选择师门技能！'
              ,skin: 'msg'
              ,time: 2 //2秒后自动关闭
            });
      }
      if($('.item-checked').length && $('.item-schecked').length){
        $.post('{:U("Recommend/matial")}',{factions:team,skill:skill},function(res) {
          //return
          if(res.err==0) {
            location.href="{:U('Recommend/apply_pusher_success')}";
          } else {
                    layer.open({
                        content:res.msg
                        ,skin: 'msg'
                        ,time: 2
                    });
                    location.href="{:U('Recommend/apply_pusher_error')}";
          }
        });

      }
    })
    </script>
    </body>

</block>